Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix problem that NewReplicaSet shows <none> when describing deployments #97752

Merged
merged 1 commit into from
Jan 20, 2021

Conversation

borgerli
Copy link
Contributor

@borgerli borgerli commented Jan 6, 2021

What type of PR is this?
/kind bug

What this PR does / why we need it:

Which issue(s) this PR fixes:
Fixes #97750

Special notes for your reviewer:
The cause of issue #97750 is that the sort.Sort calls in describeDeployment->DescribePodTemplate->describeContainers->describeContainerVolumes could change the order of the items in VolumeMounts array of containers, which will fail the equalIgnoreHash comparison in findNewReplicaSet. As a result, no new replicaset could be found, and the NewReplicaSet will show as .

So the fix is just pass the deep copy of the deployment object when calling describeDeployment

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Jan 6, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @borgerli. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added area/kubectl sig/cli Categorizes an issue or PR as relevant to SIG CLI. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jan 6, 2021
@rikatz
Copy link
Contributor

rikatz commented Jan 6, 2021

/cc
/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 6, 2021
@borgerli
Copy link
Contributor Author

borgerli commented Jan 7, 2021

/retest

@borgerli
Copy link
Contributor Author

borgerli commented Jan 7, 2021

/assign @eddiezane

@rikatz
Copy link
Contributor

rikatz commented Jan 7, 2021

  • Please add the Release Note block
  • As this generated the issue NewReplicaSet shows <none> when describing deployment #97750 can you please improve the unit test for TestDescribeDeployment? My suggestion is to follow the TestDescribeIngressNetworkPolicies func, maybe having some improvements in the tests with the expected output other then only if the command runs or not would be really better

@eddiezane Other than the above, lgtm. Will wait your opinion about improving the unit tests so future bugs can be catched earlier :)

@borgerli
Copy link
Contributor Author

borgerli commented Jan 8, 2021

  • Please add the Release Note block
  • As this generated the issue NewReplicaSet shows <none> when describing deployment #97750 can you please improve the unit test for TestDescribeDeployment? My suggestion is to follow the TestDescribeIngressNetworkPolicies func, maybe having some improvements in the tests with the expected output other then only if the command runs or not would be really better

@eddiezane Other than the above, lgtm. Will wait your opinion about improving the unit tests so future bugs can be catched earlier :)

Thanks for the comment. I'll add the unit test.

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jan 8, 2021
@borgerli
Copy link
Contributor Author

borgerli commented Jan 8, 2021

@rikatz I just modified the test case of TestDescribeDeployment by covering the NewReplicaSet info verification. Please review. Thanks.

@rikatz
Copy link
Contributor

rikatz commented Jan 8, 2021

@borgerli Thanks, will review.

Can you please edit the RELEASE NOTE block on the description of the PR and add a "NONE" into that?

Thanks

Copy link
Contributor

@rikatz rikatz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@borgerli thank you again.

I've left one review about the test. To be honest, I would expect that we test the whole output instead of only one field, so we can detect other deviations / bugs caused by future changes, there's some example on the test I've mentioned before.

If you need some help with that please let me know.

Thank you!

@@ -1719,6 +1806,10 @@ func TestDescribeDeployment(t *testing.T) {
if !strings.Contains(out, "bar") || !strings.Contains(out, "foo") || !strings.Contains(out, "Containers:") || !strings.Contains(out, "mytest-image:latest") {
t.Errorf("unexpected out: %s", out)
}
expectedNewReplicaSet := "NewReplicaSet: bar-001 (1/1 replicas created)"
if !strings.Contains(out, expectedNewReplicaSet) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, this seems a good approach. I'm mostly biased to have a comparison between the full output instead of only the NewReplicaSet string, so we can validate the behavior of the whole describe command instead of only one line (we want to get all divergences instead of only this line, right?)

Thank you!

Copy link
Contributor Author

@borgerli borgerli Jan 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, agreed. I'll improve the test case to validate all computed fields. Thank you.

@borgerli
Copy link
Contributor Author

borgerli commented Jan 9, 2021

/release-note-none

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Jan 9, 2021
@rikatz
Copy link
Contributor

rikatz commented Jan 13, 2021

@borgerli let me know when the tests are ready :)

@borgerli
Copy link
Contributor Author

@rikatz Sorry that I'm busy with work this week. I'll try to get tests ready by this Sunday.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 16, 2021
@borgerli
Copy link
Contributor Author

/retest

@borgerli
Copy link
Contributor Author

@rikatz I improved the test case. Please help review. Thanks.

@rikatz
Copy link
Contributor

rikatz commented Jan 19, 2021

Will review today

@rikatz
Copy link
Contributor

rikatz commented Jan 19, 2021

/triage accepted
/priority important-soon

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Jan 19, 2021
@rikatz
Copy link
Contributor

rikatz commented Jan 19, 2021

/lgtm

Thanks!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 19, 2021
@rikatz
Copy link
Contributor

rikatz commented Jan 19, 2021

/cc

@pwittrock
Copy link
Member

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: borgerli, pwittrock

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 20, 2021
@rikatz
Copy link
Contributor

rikatz commented Jan 20, 2021 via email

@rikatz
Copy link
Contributor

rikatz commented Jan 20, 2021

/test pull-kubernetes-e2e-gce-ubuntu-containerd

@k8s-ci-robot k8s-ci-robot merged commit 0d5a368 into kubernetes:master Jan 20, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.21 milestone Jan 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/kubectl cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note-none Denotes a PR that doesn't merit a release note. sig/cli Categorizes an issue or PR as relevant to SIG CLI. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NewReplicaSet shows <none> when describing deployment
5 participants